import type { CSSProperties } from "vue";
import { ConfigurationType } from "../types";
import type { LabelValuePart, PipePathPoint, PipePathSpeed, PipePathType } from "/@/components/types";

export enum AttrPanelType {
  Svg,
  Device,
  PipePath,
  Multiple,
  LabelValue,
  FlowPath,
}

export interface AttrItem {
  name: string;
  value?: string | number;
  unit?: string;
  slotName?: string;
  inline?: boolean;
}

export interface DevicePanelInfo {
  x: number;
  y: number;
  width: number;
  height: number;
  rotate: number;
  componentName?: string;
  imgSrc?: string;
  setRotate: (deg: number) => void;
}

export interface PipePathStyle {
  innerSize: number;
  innerColor: string;
  outerSize: number;
  outerColor: string;
  outerOpacity: number;
  dottedSize: number;
  dottedMargin: number;
}

export interface PipePathPanelInfo {
  points: PipePathPoint[];
  isFloating: boolean;
  isReverse: boolean;
  pipePathStyle: PipePathStyle;
  type: PipePathType;
  speed: PipePathSpeed;
  setFloating: (isFloating: boolean) => void;
  setReverse: (isReverse: boolean) => void;
  setStyle: (style: PipePathStyle) => void;
  setSpeed: (val: PipePathSpeed) => void;
}

export interface MultiplePanelInfo {
  deviceNum: number;
  pipePathNum: number;
  labelValueNum: number;
  flowPathNum: number;
}

export type LabelValuePosition = "vertical" | "horizontal";

export interface LabelValuePanelInfo {
  labelCssProps: CSSProperties;
  valueCssProps: CSSProperties;
  unitCssProps: CSSProperties;
  rotate: number;
  position: LabelValuePosition;
  hideValue: boolean;
  hideLabel: boolean;
  hideUnit: boolean;
  dataKey: string | null;
  setRotate: (deg: number) => void;
  setCssProps: (props: CSSProperties, labelValuePart: LabelValuePart) => void;
  setPosition: (pos: LabelValuePosition) => void;
  setPartHide: (isHide: boolean, labelValuePart: LabelValuePart) => void;
  setDataKey: (dataKey: string | null) => void;
}

export type FlowPathPanelInfo = DevicePanelInfo & {};

export interface UpdatePanelOptions<T> {
  type: ConfigurationType;
  panelInfo: Partial<T>;
  // panelInfo: Partial<DevicePanelInfo | PipePathPanelInfo | MultiplePanelInfo | LabelValuePanelInfo | FlowPathPanelInfo>;
}
